home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / C / CRACKLIB.ZIP / CRACKLIB.TAR / cracklib25_small / util / testnum.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-09  |  811 b   |  44 lines

  1. /*
  2.  * This program is copyright Alec Muffett 1993. The author disclaims all 
  3.  * responsibility or liability with respect to it's usage or its effect 
  4.  * upon hardware or computer systems, and maintains copyright as set out 
  5.  * in the "LICENCE" document which accompanies distributions of Crack v4.0 
  6.  * and upwards.
  7.  */
  8.  
  9. #include "packer.h"
  10.  
  11. int
  12. main ()
  13. {
  14.     int32 i;
  15.     PWDICT *pwp;
  16.     char buffer[STRINGSIZE];
  17.  
  18.     if (!(pwp = PWOpen (CRACKLIB_DICTPATH, "r")))
  19.     {
  20.     perror ("PWOpen");
  21.     return (-1);
  22.     }
  23.  
  24.     printf("enter dictionary word numbers, one per line...\n");
  25.  
  26.     while (fgets (buffer, STRINGSIZE, stdin))
  27.     {
  28.     char *c;
  29.  
  30.     sscanf (buffer, "%lu", &i);
  31.  
  32.     printf ("(word %ld) ", i);
  33.  
  34.     if (!(c = (char *) GetPW (pwp, i)))
  35.     {
  36.         c = "(null)";
  37.     }
  38.  
  39.     printf ("'%s'\n", c);
  40.     }
  41.  
  42.     return (0);
  43. }
  44.